#include "frameboxbody.h"

#include <QRegExpValidator>

FrameBoxBody::FrameBoxBody()
{

}
FrameBoxBody::FrameBoxBody(QWidget *parent):
    QFrame(parent)
{
    //this->setObjectName(QStringLiteral("frameBoxBody_1"));
    this->setMinimumSize(QSize(0, 55));
    this->setFrameShape(QFrame::StyledPanel);
    this->setFrameShadow(QFrame::Raised);



    gridLayout = new QGridLayout(this);
    gridLayout->setSpacing(3);
    gridLayout->setContentsMargins(11, 11, 11, 11);
    gridLayout->setObjectName(QStringLiteral("gridLayout"));
    gridLayout->setContentsMargins(8, 0, 0, 7);

    lineEditDID = new QLineEditEx(this,DidType_7E);
    lineEditDID->setObjectName(QStringLiteral("lineEditDID"));
    lineEditDID->setMinimumSize(QSize(35, 22));
    lineEditDID->setMaximumSize(QSize(30, 16777215));
    lineEditDID->setMaxLength(4);
    lineEditDID->setText("0003");
    gridLayout->addWidget(lineEditDID, 2, 1, 1, 2);
    lineEditDID->setValidator(new QRegExpValidator(QRegExp("[0-9A-Fa-f]{0,4}"),this));


    lineEditData = new QLineEdit(this);
    lineEditData->setObjectName(QStringLiteral("lineEditData_2"));
    lineEditData->setMinimumSize(QSize(20, 22));

    gridLayout->addWidget(lineEditData, 2, 3, 1, 1);
    lineEditDID->setAlignment(Qt::AlignCenter);
    label_data = new QLabel(this);
    label_data->setObjectName(QStringLiteral("label_data"));
    label_data->setMinimumSize(QSize(30, 22));
    label_data->setAlignment(Qt::AlignCenter);
    label_data->setText("data");

    gridLayout->addWidget(label_data, 0, 3, 1, 1);

    label_did = new QLabel(this);
    label_did->setObjectName(QStringLiteral("label_did"));
    label_did->setMinimumSize(QSize(20, 22));
    label_did->setMaximumSize(QSize(30, 16777215));
    label_did->setAlignment(Qt::AlignCenter);
    label_did->setText("did");
    gridLayout->addWidget(label_did, 0, 1, 1, 2);


    animation.setTargetObject(this);
    animation.setPropertyName("maximumWidth");
    animation.setDuration(350);

}
FrameBoxBody::~FrameBoxBody()
{
    delete gridLayout;
    delete lineEditDID;
    delete lineEditData;
    delete label_data;
    delete label_did;
}
void FrameBoxBody::hideWithAnimate(bool flag)
{
    if(true == flag)
        animation.setEndValue(0);
    else
        animation.setEndValue(200);

    animation.start();

}
